package java1;

import java.util.Scanner;

public class TwoToTen {
    public static void main(String [] args){
        Scanner input = new Scanner(System.in);
        String str = input.nextLine().trim();
        int result= 0;
        for(int i = 0;i < str.length();i++){
            char c = str.charAt(str.length() - 1 - i);
            if(c < '0' || c > '9') {
                System.out.println("二进制输入格式错误");
                System.exit(1);
            }
            //二进制转换成十进制
            result += (int)(c - '0') * Math.pow(2, i);
        }
        System.out.println(result);
    }
}
